package com.webkitlib.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class NetworkInternet {
	public static boolean getNetWorkInfo(Context cont) {
		try {

			ConnectivityManager manager = (ConnectivityManager) cont
					.getApplicationContext().getSystemService(
							Context.CONNECTIVITY_SERVICE);
			if (manager == null) {
				return false;
			}
			NetworkInfo networkinfo = manager.getActiveNetworkInfo();
			if (networkinfo == null || !networkinfo.isAvailable()
					|| !networkinfo.isConnectedOrConnecting()) {
				return false;
			} else {
					return true;
			}

		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
	}
	public boolean isWifiConnected(Context context) {
		if (context != null) {
			return getNetWorkInfo(context);
		}
		return false;
	}
}
